-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(init): support initializing npm projects #26896
base: main
Are you sure you want to change the base?
Conversation
cli/main.rs
Outdated
if dir.starts_with("jsr:") { | ||
bail!("Initializing project from a jsr package is currently not supported."); | ||
} else if dir.starts_with("npm:") { | ||
// TODO: do prompt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BLOCKER FOR LANDING:
Do the confirmation prompt if user wants to allow all permissions and post-install scripts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If user doesn't grant it, we should print a message how this could be executed manually using deno run
subcommand - eg. deno run npm:create-vite
$ deno init npm:preact
error: Could not find a matching package for 'npm:create-preact' in the node_modules directory. Ensure you have all your JSR and npm dependencies listed in your deno.json or package.json, then run `deno install`. Alternatively, turn on auto-install by specifying `"nodeModulesDir": "auto"` in your deno.json file. EDIT: Ignore what I wrote. I had a |
Thanks, I know what the problem is, will fix it tonight. |
This commit adds support for
deno init npm:<package>
.Running this will actually call to
npm:create-<package>
package thatis equivalent to running
npm create <package>
.User will be prompted if they want to allow all permissions and lifecycle scripts
to be executed. It was discussed internally if we should accept permission flags here
but it will be really cumbersome and in most cases these creation scripts need to do
a lot of crazy stuff including reaching out to networks, reading and writing to file system,
reading env vars and spawning subprocesses.
Closes #26461